#ifndef CAMPAIGN_H
#define CAMPAIGN_H


#include "dtwenty_global.h"


#include "attributes.h"
#include "dice.h"
#include "feats.h"
#include "skills.h"
#include "specialabilities.h"


#include <root.h>


#include <QMetaType>



class DTWENTYSHARED_EXPORT CharacterClasses : public Collection
{
    Q_OBJECT

public:

    Q_INVOKABLE CharacterClasses(QObject *parent = 0) :
        Collection(QT_TR_NOOP("Character Classes"), parent)
    {
    }

    CharacterClasses(const CharacterClasses& other) :
        Collection(other)
    {
    }

    Q_INVOKABLE virtual void onInitialize()
    {
        if (metaData()) return;

        (void) new MetaData(this);
    }

};
Q_DECLARE_METATYPE(CharacterClasses*)


class DTWENTYSHARED_EXPORT Campaign : public Root
{
    Q_OBJECT

public:

    enum Field
    {
        Field_FIRST = 0,

        Field_NAME = Field_FIRST,
        Field_DESC,

        Field_LAST = Field_DESC
    };

    static Campaign* create(QObject* parent = 0)
    {
        return qobject_cast<Campaign*>(Collection::create("Campaign", parent));
    }

    Q_INVOKABLE Campaign(QObject *parent = 0) :
        Root(parent)
    {
    }

    Campaign(const Campaign& other) :
        Root(other)
    {
    }

    Q_INVOKABLE virtual void onInitialize()
    {

        setField(Field_NAME, QT_TR_NOOP("Name"));
        setField(Field_DESC, QT_TR_NOOP("Description"));

        if (!findChild<Dice*>()) Collection::create("Dice", this);
        if (!findChild<Attributes*>()) Collection::create("Attributes", this);
        if (!findChild<Skills*>()) Collection::create("Skills", this);
        if (!findChild<Feats*>()) Collection::create("Feats", this);
        if (!findChild<SpecialAbilities*>()) Collection::create("SpecialAbilities", this);
        if (!findChild<CharacterClasses*>()) Collection::create("CharacterClasses", this);
    }

};


Q_DECLARE_METATYPE(Campaign*)


#endif // CAMPAIGN_H
